package client.popups.meeting;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.List;

import javax.swing.JFrame;

import client.popups.wizard.MeetingParticipantsWizard;

import data.PropertyChangeSpeaker;
import data.User;

public class ParticipantsOverview extends JFrame implements PropertyChangeSpeaker, PropertyChangeListener{
	
	private PropertyChangeSupport pcs;
	private MeetingParticipantsWizard participantsPanel; 
	
	
	public ParticipantsOverview(List<User> part){
		pcs = new PropertyChangeSupport(this);
		participantsPanel = new MeetingParticipantsWizard(part, false);
		participantsPanel.addPropertyChangeListener(this);
		getContentPane().add(participantsPanel);
	}
	
	public void addPropertyChangeListener(PropertyChangeListener listener){
		pcs.addPropertyChangeListener(listener);
	}

	public void removePropertyChangeListener(PropertyChangeListener listener){
		pcs.removePropertyChangeListener(listener);
	}

	@Override
	public void propertyChange(PropertyChangeEvent evt) {
		// TODO Auto-generated method stub
		if(evt.getPropertyName().equals("sendParticipantsList")){
			pcs.firePropertyChange("sendParticipantsList", null, evt.getNewValue());
			dispose();
		}
	}
	
	public String toString(){
		return "Dette er ParticipantsOverview";
	}
}
